package com.payment.plugin;


import com.payment.request.TransRequest;
import com.payment.vo.PayResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * @ClassName: PayPlugin
 * @Description:
 * @author: fengcheng @date: 2021/03/25
 */
@Slf4j
public abstract class PaymentPlugin {

    /**
     * 获取支付插件ID
     */
    public String getId() {
        return getClass().getAnnotation(Component.class).value();
    }


    /**
     * 支付
     *
     * @param request
     * @return
     */
    public abstract PayResult pay(TransRequest request);

    /**
     * 支付
     *
     * @param request
     * @return
     */
    public abstract PayResult payQuery(TransRequest request);

    /**
     * 退款
     *
     * @param transRequest
     * @return
     */
    public abstract PayResult refund(TransRequest transRequest);

    /**
     * 退款结果查询
     *
     * @param transRequest
     * @return
     */
    public abstract PayResult refundQuery(TransRequest transRequest);
}
